/* 
 * File:   Layout.h
 * Author: nata
 *
 * Created on March 27, 2012, 11:26 AM
 */

#ifndef LAYOUT_H
#define	LAYOUT_H

#include <vector>

#include "Node.h"
#include "Image.h"

using namespace std;

enum Direction { LEFT, RIGHT };

class Layout {
private:
    int width;
    int height;
    int alpha;
    int beta;
    Node* root;
    double score2004(Node* node);
    double score2008(Node* node);
    double sumEstimatedAreas(Node* node, double eSum);
    double sumRelativeAreas(Node* node);
    double leafIdealArea(Node* leaf, double eSum);
    void generateTrees(Node* root, Node* actual, Node* leaf, vector<Node* >* scores);
    void generateTree(Node* root, Node* actual, Node* leaf, vector<Node* >* scores, Orientation orientation);
    Node* getMax(vector<Node* > *trees);

    
public:
    Layout(vector<Image*> *images, int width, int height, int alpha, int beta);
    Layout(Node* root, int width, int height, int alpha, int beta);
    Layout(Layout* layout);
    Node* createTree(vector<Image*> *images);
    void setWidth(int width);
    void setHeight(int height);
    void setAlpha(int alpha);
    void setBeta(int beta);
    void setRoot(Node* root);
    int getWidth();
    int getHeight();
    int getTotalDimension(Orientation orientation);
    int getAlpha();
    int getBeta();
    int getArea();
    int getTotalArea();
    Node* getRoot();
};

#endif	/* LAYOUT_H */

